Creating URL format rules

If you are testing a web application hosted on different web servers, you can create a URL format rule that compares the domain name in URLs to multiple domain names specified in a regular expression. QA Wizard Pro successfully locates a control if the domain matches a value returned by the regular expression. See Running web scripts against different servers.

Use URL format rules to specify how to handle parts of dynamic URLs. This allows QA Wizard Pro to locate controls when the URL changes. Format rules can always be applied to URLs or only be applied when URLs meet specified conditions. See Using URL format rules.

Following is an example of a dynamic URL: http://www.wysicorp.com/wysicrm/news/2008/index.htm?date=20081015&lang=en#latest

The parameters in this URL are likely to change after recording, which may cause scripts to fail if control properties used as search criteria use this URL as the expected value. You can create URL format rules to ignore specific parameters during playback.

Following are the parts of the URL you can create format rules for.

Part Description Example
Protocol Protocol used to retrieve the requested page from the web server http
Domain Domain where the web server is hosted www.wysicorp.com
Path Location on the web server wysicrm
news
2008
File File requested from the web server index.htm
Parameters Name/value pair appended to a URL that passes information from the browser to the web server; parameters start with a question mark (?) and are separated by ampersands (&) date=20081015
lang=en
Anchor Named anchor, or bookmark, that identifies an internal section of a web page; anchors start with a pound sign (#) latest

1. Select a web application version in the application repository and choose File > Properties.

The Properties dialog box opens.

2. Click the URL Formats tab.

3. Click Add.

An empty row is added to the Rules list.

4. In the new row, select or enter a Part.

Note: If the URL path has multiple levels, you can specify each path value separately. For example, if the path is three levels deep, add Path(1), Path(2), and Path(3) parts. Any values entered except Protocol, Domain, Path, File, or Anchor are interpreted as URL parameters.

5. Select an Action.

6. Enter the Expected Value.

QA Wizard Pro searches for the expected value in the URL and applies the rule if it is found. An expected value is not required if Exists or Ignore is selected in the Action column.

Tip: If repository variables are configured for the application version, you can use them in URL format expected values. Repository variables are displayed on the Repository Variables tab in the version Properties dialog box. See Creating repository variables.

7. Select a Condition to indicate when to apply the rule to URLs.

8. Optionally click Apply Formats to update URLs in the repository. See Applying URL format rules.

9. Optionally select Automatically apply formats during record to apply the rules during future recording sessions.

If this option is selected, the action of every control property with a URL value in the application version is set to Matches format. The format rules are applied when controls are added to the repository after recording or populating.

10. Click OK to save the changes.